<template>
  <div>
    <h1>管理员管理</h1>
    <el-form ref="form" :model="form" label-width="80px">
      <el-form-item label="角色名称">
        <el-select v-model="form.rolename" placeholder="请选择">
          <el-option v-for="(role, index) in roleList" :key="index" :label="role.rolename" :value="role.id"></el-option>
        </el-select>
      </el-form-item>
    </el-form>
  </div>
</template>
<script>
import {getRole} from '../request/index'
export default {
  data() {
    return {
      form: {
        rolename: ''
      },
      roleList: []
    }
  },
  created() {
    // 获取下拉列表中的数据，角色列表，是一个数组
    this.getRolelist()
  },
  methods: {
    async getRolelist() {
      let res = await getRole();
      this.roleList = res.list;
    }
  }
};
</script>
<style lang="">
</style>